/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Frmelimprof.java
 *
 * Created on 18/02/2011, 11:49:59 PM
 */
package interfaz1;

import java.awt.Frame;
import javax.swing.JOptionPane;

/**
 *
 * @author CLIENTE
 */
public class Frmelimprof extends javax.swing.JFrame {

    /** Creates new form Frmelimprof */
    public Frmelimprof() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        lblelimprof = new javax.swing.JLabel();
        lblcedelimprof = new javax.swing.JLabel();
        lblnomelimprof = new javax.swing.JLabel();
        lblapelimprof = new javax.swing.JLabel();
        lbltitelimprof = new javax.swing.JLabel();
        txtcedelimprof = new javax.swing.JTextField();
        txtmnomelimprof = new javax.swing.JTextField();
        txtapelimprof = new javax.swing.JTextField();
        txttiuelimprof = new javax.swing.JTextField();
        btnelimprof = new javax.swing.JButton();
        btncancelimprof = new javax.swing.JButton();
        btnsalirelimprof = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Profesor");
        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        lblelimprof.setFont(new java.awt.Font("Bookman Old Style", 1, 12));
        lblelimprof.setText("Eliminar Profesor");
        getContentPane().add(lblelimprof, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 30, 130, -1));

        lblcedelimprof.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        lblcedelimprof.setText("Cedula:");
        getContentPane().add(lblcedelimprof, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 70, 50, 20));

        lblnomelimprof.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        lblnomelimprof.setText("Nombre:");
        getContentPane().add(lblnomelimprof, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 110, 50, 20));

        lblapelimprof.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        lblapelimprof.setText("Apellido:");
        getContentPane().add(lblapelimprof, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 150, 60, 20));

        lbltitelimprof.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        lbltitelimprof.setText("Titulo Obtenido:");
        getContentPane().add(lbltitelimprof, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 190, 100, 20));

        txtcedelimprof.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        getContentPane().add(txtcedelimprof, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 70, 140, -1));

        txtmnomelimprof.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        getContentPane().add(txtmnomelimprof, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 110, 140, -1));

        txtapelimprof.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        getContentPane().add(txtapelimprof, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 150, 140, -1));

        txttiuelimprof.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        getContentPane().add(txttiuelimprof, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 190, 140, -1));

        btnelimprof.setText("Eliminar");
        btnelimprof.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnelimprofActionPerformed(evt);
            }
        });
        getContentPane().add(btnelimprof, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 260, -1, -1));

        btncancelimprof.setText("Cancelar");
        btncancelimprof.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btncancelimprofActionPerformed(evt);
            }
        });
        getContentPane().add(btncancelimprof, new org.netbeans.lib.awtextra.AbsoluteConstraints(180, 260, -1, -1));

        btnsalirelimprof.setText("Salir");
        btnsalirelimprof.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnsalirelimprofActionPerformed(evt);
            }
        });
        getContentPane().add(btnsalirelimprof, new org.netbeans.lib.awtextra.AbsoluteConstraints(310, 260, 70, -1));

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-416)/2, (screenSize.height-336)/2, 416, 336);
    }// </editor-fold>//GEN-END:initComponents

    private void btnsalirelimprofActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnsalirelimprofActionPerformed
        // TODO add your handling code here:
        FrmOperacionesseccion frmopsec = new FrmOperacionesseccion();
        frmopsec.show();
        dispose();
    }//GEN-LAST:event_btnsalirelimprofActionPerformed

    private void btnelimprofActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnelimprofActionPerformed
        // TODO add your handling code here:
        Profesor miprofesor = FrmOperacionesseccion.getMiseccion().BuscarProfesor(txtcedelimprof.getText());
        if (miprofesor != null) {

                FrmOperacionesseccion.getMiseccion().EliminarProfesor(txtcedelimprof.getText());
               JOptionPane.showMessageDialog(new Frame(), "El profesor eliminado", "Aviso", JOptionPane.PLAIN_MESSAGE);
               FrmOperacionesseccion.setEncon(false);
               dispose();
        } else {
            JOptionPane.showMessageDialog(new Frame(), "El profesor no existe", "Aviso", JOptionPane.PLAIN_MESSAGE);
        }

    }//GEN-LAST:event_btnelimprofActionPerformed

    private void btncancelimprofActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btncancelimprofActionPerformed
        // TODO add your handling code here:
        txtapelimprof.setText("");
        txtcedelimprof.setText("");
        txtmnomelimprof.setText("");
        txttiuelimprof.setText("");
    }//GEN-LAST:event_btncancelimprofActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new Frmelimprof().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btncancelimprof;
    private javax.swing.JButton btnelimprof;
    private javax.swing.JButton btnsalirelimprof;
    private javax.swing.JLabel lblapelimprof;
    private javax.swing.JLabel lblcedelimprof;
    private javax.swing.JLabel lblelimprof;
    private javax.swing.JLabel lblnomelimprof;
    private javax.swing.JLabel lbltitelimprof;
    private javax.swing.JTextField txtapelimprof;
    private javax.swing.JTextField txtcedelimprof;
    private javax.swing.JTextField txtmnomelimprof;
    private javax.swing.JTextField txttiuelimprof;
    // End of variables declaration//GEN-END:variables
}
